package com.zpdhy.system.controller;

import com.zpdhy.system.model.UserInfo;
import com.zpdhy.system.service.UserInfoService;
import com.zpdhy.system.shiro.DynamicUpdatePermission;
import com.zpdhy.util.EndecryptUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.Map;

/**
 * Created by kedong on 2016/12/30.
 */
@Controller
@RequestMapping("/permission/")
public class SysPermissinController {

    @Resource
    private DynamicUpdatePermission updatePermission;

    @Autowired
    private UserInfoService userInfoService;

    /**
     * 用户查询.
     *
     * @return
     */
    @RequestMapping("/list")
    public String list() {

        return "permission/list";
    }

    /**
     * 用户添加;
     *
     * @return
     */
    @RequestMapping("/add")
    public String add(Map<String, Object> map) {
        return "permission/add";
    }

    @PostMapping("saveOrUpdate")
    public String saveOrUpdate(UserInfo userInfo) {

        updatePermission.updateShiroFilter();
        return "redirect:list";
    }
}
